home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / rexx / 481 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.7 KB  |  90 lines

  1. Newsgroups: comp.lang.rexx
  2. Subject: EHLLAPI Download file exa
  3. From: david.lewis@canrem.com (David Lewis)
  4. Path: canrem.com!david.lewis
  5. Distribution: world
  6. Message-ID: <60.10162.4414.0N20840A@canrem.com>
  7. Date: Wed, 24 Jan 96 00:53:00 -0500
  8. Organization: CRS Online  (Toronto, Ontario)
  9.  
  10. Hi Simon.
  11.  
  12. S> I urgently need an example of downloading a file from a VM host using
  13. S> EHLLAPI under Rexx or C.  I'm new to this and am using PC/3270 4.0
  14. S> for  OS/2. It seems I can't run the AFTP programs etc ('cos it appears
  15. S> to need CM/2 DLLs)
  16.  
  17. From the book, "OS/2 REXX: From Bark to Byte", GG24-4199:
  18.  
  19. /*EHLSF.CMD  */
  20. /* send OS2.INI , OS2SYS.INI files to host for backup */                
  21.                                                                 
  22.  
  23. parse arg session                     /* host session to work with */
  24. if session = '' then
  25.    session  = 'A'
  26.  /* load hllapi functions */
  27.  if Rxfuncquery('hllapi') then
  28.    call Rxfuncadd 'HLLAPI','SAAHLAPI','HLLAPISRV'
  29.  
  30.  /* connect to session */
  31.  rc= hllapi('Connect',session)                     /* connect to host session */
  32.  rc= hllapi('Set_session_parms','TIMEOUT=J')  /* timeout after 5 minutes  */
  33.                                                               /* on send, receive   */
  34. /* check status of VM session */
  35.  rc1= hllapi('Search_PS','VM READ',1)   
  36.  rc2= hllapi('Search_PS','RUNNING',1) 
  37.  
  38. /* must disconnect before sending file */
  39.  rc= hllapi('Disconnect')
  40.  
  41.  if (rc1>0 | rc2>0) then     /* found VMREAD or RUNNING */
  42.    call SendIniFiles
  43.  else 
  44.     say ' host is not in a VM READY or VM RUNNING state. Terminating program.'
  45.  
  46. return
  47.  
  48.  
  49.  
  50. /******************************************************/
  51. /******************************************************/
  52. SendIniFiles: Procedure Expose session
  53.  
  54. /* get path of system and user INI files */
  55. os2ini=VALUE(SYSTEM_INI,,OS2ENVIRONMENT)
  56. userini=VALUE(USER_INI,,OS2ENVIRONMENT)
  57.  
  58. /* concatenate host session , filename  */
  59. os2_ini_string=os2ini session||':' 'OS2SYS INI A '
  60. user_ini_string=userini session||':' 'OS2 INI A '
  61.  
  62. /* send system INI file to host */
  63. rc=hllapi('Send_file',os2_ini_string)
  64. if rc \=3 then  
  65.   say 'Error sending file ' os2ini ' to host session ' session||'.  RC = ' rc
  66.  
  67. /* send user INI file to host */
  68. rc=hllapi('Send_file',user_ini_string)
  69. if rc \=3 then  
  70.   say 'Error sending file ' os2ini ' to host session ' session||'.  RC = ' rc
  71.  
  72. return
  73.  
  74. S> If you have any such examples which you are willing to show me,
  75. S> please e-mail them to me directly.
  76.  
  77. Posted here in case anyone else is interested.  Also sent by e-mail.
  78.  
  79. S> A beer to the first one to help (of course you have to collect it).
  80.  
  81. Do I win?
  82.  
  83. S> Simon Bowring
  84. S> Senior Software Engineer
  85. S> MPC Data Limited
  86.  
  87. Dave
  88. ---
  89.  * KWQ/2 1.2i * Exit, stage right!
  90.